package com.wyzz.hr.pojo;

import com.wyzz.hr.base.Constants;
import com.wyzz.hr.pojo.base.BaseEmpbenefitplan;
import com.wyzz.hr.util.MyTools;

import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public class Empbenefitplan extends BaseEmpbenefitplan implements Constants {

	public Empbenefitplan() {
		empMonthCount = Integer.valueOf(0);
	}

	public Empbenefitplan(Employee emp, String yearMonth,
			String belongYearMonth, Integer ebpStatus) {
		empMonthCount = Integer.valueOf(0);
		setEbpEmpno(emp);
		setEbpYearMonth(yearMonth);
		setEbpBelongYearmonth(belongYearMonth);
		setEbpStatus(ebpStatus);
	}

	public Empbenefitplan(Empbenefit benefit) {
		empMonthCount = Integer.valueOf(0);
		setEbpEmpno(benefit.getEmployee());
		setEbpPensionAmountb(benefit.getEbfPensionAmount());
		setEbpHousingAmountb(benefit.getEbfHousingAmount());
		setEbpInsuranceAmountb(benefit.getEbfInsuranceAmount());
	}

	public void encryEMPPlan(Empbenefitplan plan) {
		String empId = plan.getEbpEmpno().getId();
		Class ownerClass = plan.getClass();
		try {
			for (int i = 1; i <= 48; i++) {
				Method ebpMethod = ownerClass.getMethod((new StringBuilder())
						.append("getEbpColumn").append(i).toString(),
						new Class[0]);
				BigDecimal temp = (BigDecimal) ebpMethod.invoke(plan,
						new Object[0]);
				plan.setEncry((new StringBuilder()).append("EbpColumn").append(
						i).toString(), temp, empId, MyTools.BIGDECIMAL);
			}

			plan.setEncry("EbpComments", plan.getEbpComments(), empId,
					MyTools.CHINESE);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void decryEMPPlan(Empbenefitplan plan) {
		String empId = plan.getEbpEmpno().getId();
		try {
			Class ownerClass = plan.getClass();
			for (int i = 1; i <= 48; i++) {
				Method ebpMethod = ownerClass.getMethod((new StringBuilder())
						.append("setEbpColumn").append(i).toString(),
						new Class[] { java.math.BigDecimal.class });
				ebpMethod.invoke(plan, new Object[] { (BigDecimal) plan
						.getDecry((new StringBuilder()).append("EbpColumn")
								.append(i).toString(), empId,
								MyTools.BIGDECIMAL) });
			}

			plan.setEbpComments((String) plan.getDecry("EbpComments", empId,
					MyTools.CHINESE));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public BigDecimal getShowColumn15() {
		return showColumn15;
	}

	public void setShowColumn15(BigDecimal showColumn15) {
		this.showColumn15 = showColumn15;
	}

	public BigDecimal getShowColumn16() {
		return showColumn16;
	}

	public void setShowColumn16(BigDecimal showColumn16) {
		this.showColumn16 = showColumn16;
	}

	public List getOutputList() {
		return outputList;
	}

	public void setOutputList(List outputList) {
		this.outputList = outputList;
	}

	public Integer getEmpMonthCount() {
		return empMonthCount;
	}

	public void setEmpMonthCount(Integer empMonthCount) {
		this.empMonthCount = empMonthCount;
	}

	public List getAcctItems() {
		return acctItems;
	}

	public void setAcctItems(List acctItems) {
		this.acctItems = acctItems;
	}

	public Map getOutPutList() {
		return outPutList;
	}

	public void setOutPutList(Map outPutList) {
		this.outPutList = outPutList;
	}

	private static final long serialVersionUID = 1L;
	private BigDecimal showColumn15;
	private BigDecimal showColumn16;
	private Integer empMonthCount;
	private List acctItems;
	private List outputList;
	private Map outPutList;
}
